import {HttpClient} from "@angular/common/http";
import {Injectable} from "@angular/core";
import {Occasion} from "../models/occasion.model";
@Injectable({
  providedIn: "root"
})
export class LostOrFindService {
  constructor(private http: HttpClient) {

  }
  private baseUrl:string = "https://localhost:44328/api/lostorfind";
  public getSome(from: number, to: number, lost: boolean = true){
    return this.http.get<Occasion[]>(`${this.baseUrl}?from=${from}&to=${to}&lost=${lost}`);
  }
  public getDirect(id: number){
    return this.http.get<Occasion>(`${this.baseUrl}/${id}`);
  }
  public getAllWithLoggedUser(userId: number){
    return this.http.get<Occasion[]>(`${this.baseUrl}/user/${userId}`);
  }
  public deleteOccasion(occasionId: number){
    return this.http.delete<any>(`${this.baseUrl}/${occasionId}`)
  }
}
